<div id="<?php echo $this->config->item('site_accr'); ?>_menu">
	<?php
	
	$iApps = $qApps->num_rows();
	
	$url = $this->uri->uri_string();
	
	for ($i = 0; $i < $iApps; $i++)
	{
		if ($qApps->row($i)->app_top_menu === 'Y')
		{
			$bCurrent = false;
			$aPath = explode("/", substr($qApps->row($i)->app_path, 1));
			
			if(count($aPath) > 2 && $aPath[2] == 'edit_page' && (strpos($url, '/pages/edit_page') !== false || strpos($url, '/pages/add_page') !== false))
			{
				$bCurrent = true;
			}
			else if(count($aPath) > 1 && strpos($url, $qApps->row($i)->app_path) !== false && strpos($url, 'edit_page') === false && strpos($url, 'add_page') === false)
			{
				$bCurrent = true;
			}
			else if($qApps->row($i)->app_path == $url)
			{
				$bCurrent = true;
			}
			
			?>
			<div class="<?php echo $this->config->item('site_accr'); ?>_menu_item<?php echo $bCurrent ? ' menu_item_current' : ''; ?>">
				<a href="<?php echo $qApps->row($i)->app_path; ?>" title="<?php echo $qApps->row($i)->app_text; ?>"><?php echo $qApps->row($i)->app_text; ?></a>
			</div>
			<?php
		}
		
		
	}
	
	?>
	<div class="<?php echo $this->config->item('site_accr'); ?>_clear"></div>
</div>